public class TestPriority {
    public static void main(String[] args) {
        // main Thread
        System.out.println(Thread.currentThread().getName()+"-->"+Thread.currentThread().getPriority());
        // son thread
        MyPriority priority=new MyPriority();
        Thread t1=new Thread(priority,"t1");
        Thread t2=new Thread(priority,"t2");
        Thread t3=new Thread(priority,"t3");
        Thread t4=new Thread(priority,"t4");
        Thread t5=new Thread(priority,"t5");
        Thread t6=new Thread(priority,"t6");
        // 设置优先级，再启动
        t1.start();
        t2.setPriority(1);
        t2.start();
        t3.setPriority(4);
        t3.start();
        t4.setPriority(Thread.MAX_PRIORITY); //10
        t4.start();
        //t5.setPriority(11);
        t5.start();
        //t6.setPriority(-1);
        t6.start();
    }
}

class MyPriority implements Runnable{
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName()+"-->"+Thread.currentThread().getPriority());
    }
}
